class Event {
  constructor(){
    this.callback = {}
  }
  $on(name,fn){
      (this.callback[name] || (this.callback[name] = [])).push(fn)
  }
  $emit(name,data){
    if (this.callback[name]) {
      this.callback[name].forEach(element => {
        element.call(this,data)
      });
    }
  }
  $off(name) {
    delete this.callback[name]
  }
}

const abc = new Event()
abc.$on('get',function(data){
  console.log('执行了',data)
})

setTimeout(()=>{
  abc.$emit('get',{a:1})
})

abc.$remove('get',{a:1})